package com.gin.no_gay_alliance.adpter;

import android.content.Context;

import androidx.annotation.NonNull;

import com.gin.common.utils.TimeUtils;
import com.gin.no_gay_alliance.adpter.base.BaseBindingRecyclerViewAdapter;
import com.gin.no_gay_alliance.databinding.ItemTimestampBinding;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/12/26 16:28
 **/
public class TimestampAdapter extends BaseBindingRecyclerViewAdapter<ItemTimestampBinding, Long> {
    public TimestampAdapter(Context context) {
        super(context);
    }

    public TimestampAdapter(@NonNull Context context, @NonNull List<Long> data) {
        super(context, data);
    }

    /**
     * 绑定数据
     *
     * @param holder
     * @param b        绑定对象
     * @param position 位置
     * @param item
     */
    @Override
    protected void onBindViewHolder(ViewHolder<ItemTimestampBinding> holder, @NonNull ItemTimestampBinding b, int position, Long item) {
        b.tv.setText(TimeUtils.format(item, TimeUnit.SECONDS, TimeUtils.SHORT_FORMATTER));
    }
}
